extends HBoxContainer
@export var stats:Stats

@onready var health_bar: TextureProgressBar = $VBoxContainer/healthBar
@onready var eased_health_bar: TextureProgressBar = $VBoxContainer/healthBar/easedHealthBar
@onready var energy_bar: TextureProgressBar = $VBoxContainer/energyBar


func _ready() -> void:
	stats.health_chenged.connect(update_health)
	update_health()
	
	stats.energy_chenged.connect(update_energy)
	update_energy()
	
func update_health()->void:
	var percentage := stats.health / float(stats.max_health)
	health_bar.value = percentage
	create_tween().tween_property(eased_health_bar,"value",percentage,0.8)
	
func update_energy()->void:
	var percentage :=stats.energy / stats.max_energy
	energy_bar.value = percentage
	
	pass
